package cn.edu.scau.cmi.luodongmei.gui;

import cn.edu.scau.cmi.luodongmei.singleton.Chairman;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;

public class SingleChairman extends Pane {
	Chairman chairman = Chairman.getInstance("毛泽东");
	
	public SingleChairman() {
		
		BorderPane borderPane = new BorderPane();
		
		borderPane.setPrefSize(300, 300);
		
		Text text = new Text("请输入待创建的主席名：");
		
		TextField tf = new TextField();
		tf.setMaxWidth(100);
			
		Button bt = new Button("创建");
		
		Text check = new Text();
		
		bt.setOnMouseClicked(e->{
			chairman = Chairman.getInstance(tf.getText());
			
			check.setText("您创建的主席是"+tf.getText()+",验证后获取到的主席为"+chairman.getName());
			
			
		});
		
		
		
		VBox vbox = new VBox(20);
		
		vbox.getChildren().addAll(text,tf,bt,check);
		
		vbox.setAlignment(Pos.CENTER);
		
		
		
		borderPane.setCenter(vbox);
		
		getChildren().add(borderPane);
	}
}
